#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

typedef int DataType;

typedef struct List {
	DataType data;
	struct List* next;
}list;

void List_Delete(list* s)
{
	if (s == s->next)
	{
		return;
	}
	list* del = s;
	while (del->next != s)
	{
		del = del->next;
	}
	list* prev = del;
	while (prev->next != del)
	{
		prev = prev->next;
	}
	prev->next = s;
	free(del);
}

int main()
{
	
	list* node1 = (list*)malloc(sizeof(list));
	list* node2 = (list*)malloc(sizeof(list));
	list* node3 = (list*)malloc(sizeof(list));
	list* node4 = (list*)malloc(sizeof(list));
	
	node1->data = 1;
	node1->next = node2;
	node2->data = 2;
	node2->next = node3;
	node3->data = 3;
	node3->next = node4;
	node4->data = 4;
	node4->next = node1;
	List_Delete(node1);

	/*list node1, node2, node3, node4;
	node1.data = 1;
	node1.next = &node2;
	node2.data = 2;
	node2.next = &node3;
	node3.data = 3;
	node3.next = &node4;
	node4.data = 4;
	node4.next = &node1;

	List_Delete(&node3);*/
	return 0;
}